from pydantic import BaseModel, Field
from datetime import datetime
from typing import Optional

from app.schemas.user import UserDTO

# 账户相关的Schema
class AccountBase(BaseModel):
    balance: float = Field(..., ge=0)

class AccountCreate(AccountBase):
    user_id: int

class AccountRecharge(BaseModel):
    amount: float = Field(..., gt=0)

class AccountDTO(BaseModel):
    id: int
    user_id: int
    create_at: datetime
    update_at: datetime
    user: Optional[UserDTO] = None
    class Config:
        from_attributes = True
